<?php
namespace app\user\validate\teacher;

use think\Validate;

/**
 * 讲师课程验证
 */
class TeacherCourse extends Validate
{
    /**
     * 定义验证规则
     * 格式：'字段名'    =>    ['规则1','规则2'...]
     *
     * @var array
     */
    protected $rule = [
        'title'             => 'require',
        'category'          => 'require',
        'cover'             => 'require|integer',
        'info'              => 'require',
        'price'             => 'require|float',
        'scribing_price'    => 'require|float',
        'listing_time'      => 'require|integer',
        'course_type'       => 'require|integer|in:1,2,3',
        'section_level'     => 'require|integer|in:1,2,3',
    ];

    protected $field = [
        'title'             => '课程名称',
        'category'          => '课程分类',
        'cover'             => '课程封面',
        'info'              => '课程简介',
        'price'             => '销售价格',
        'scribing_price'    => '原价',
        'listing_time'      => '上架时间',
        'course_type'       => '课程类型',
        'section_level'     => '目录层级',
    ];

    /**
     * 定义错误信息
     * 格式：'字段名.规则名'    =>    '错误信息'
     *
     * @var array
     */
    protected $message = [

    ];

    /**
     * 验证场景
     */
    protected $scene = [
        'add' => [
            'title',
            'course_type',
            'section_level',
            'category',
            'cover',
            'info',
            'price',
            'scribing_price',
            'listing_time'
        ],
        'edit' => [
            'title',
            'category',
            'cover',
            'info',
            'price',
            'scribing_price',
            'listing_time'
        ],
    ];


}
